class popup {
    constructor() {

    }
    alert(opt) {
        let option = {
            content: opt.content || '请传入content！',
            type: opt.type || 'success',
            confirmText: opt.confirmText || '确认',
            yes: opt.yes || function () { }
        }
        Vue.$alert(option.content, option.type === 'success' ? '提示' : '错误', {
            confirmButtonText: option.confirmText,
            callback: option.yes
        });
    }
    confirm(opt) {
        let option = {
            content: opt.content || '请传入content！',
            type: 'warning',
            confirmText: opt.confirmText || '确认',
            cancelText: opt.cancelText || '取消',
            yes: opt.yes || function () { },
            no: opt.no || function () { },
        }
        Vue.$confirm(option.content, '提示', {
            confirmButtonText: option.confirmText,
            cancelButtonText: option.cancelText,
        }).then(() => {
            option.yes();
        }).catch(() => {
            option.no();
        });
    }
    miss(opt) {
        let option = {
            type: opt.type || 'message',
            content: opt.content || '消息'
        }
        if (option.type === 'success') {
            Vue.$message({
                type: 'success',
                message: option.content
            });
        }
        if (option.type === 'warning') {
            Vue.$message({
                type: 'warning',
                message: option.content
            })
        }
        if (option.type === 'error') {
            Vue.$message.error(option.content)
        }
        if (option.type === 'message') {
            Vue.$message(option.content)
        }
    }
}
window['popup'] = new popup();